import java.util.Scanner;

public class Main18 {

    public static void main(String[] args) {
        //18、设计一个程序求解e的值。精度达到10^-6。e=1+1/1!+1/2!+……1/n!
        double res=1;
        double sum=1;
        double t=1;
        int n=1;
        while (t>1e-6){
            sum*=(n++);
            t=1/sum;
            res+=t;
        }
        System.out.println(res);
    }
}
